package com.iflytek.jcy.supervise.clue.service.impl;

import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.iflytek.jcy.supervise.clue.common.enums.*;
import com.iflytek.jcy.supervise.clue.common.pojo.CommonResponse;
import com.iflytek.jcy.supervise.clue.dto.*;
import com.iflytek.jcy.supervise.clue.dto.inquisitor.ManageDTO;
import com.iflytek.jcy.supervise.clue.dto.inquisitor.QueryClueDTO;
import com.iflytek.jcy.supervise.clue.dto.response.ClueCollectionDTO;
import com.iflytek.jcy.supervise.clue.dto.response.ManageTaskDetailDTO;
import com.iflytek.jcy.supervise.clue.entity.*;
import com.iflytek.jcy.supervise.clue.mapper.ClueCollectionMapper;
import com.iflytek.jcy.supervise.clue.mapper.ClueMapper;
import com.iflytek.jcy.supervise.clue.mapper.CluePushDetailMapper;
import com.iflytek.jcy.supervise.clue.mapper.CluePushMapper;
import com.iflytek.jcy.supervise.clue.mapper.TaskDetailMapper;
import com.iflytek.jcy.supervise.clue.mapper.TaskMapper;
import com.iflytek.jcy.supervise.clue.service.IClueCollectionService;
import com.iflytek.jcy.supervise.clue.service.ICluePushService;

import java.util.*;
import java.util.stream.Collectors;

import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.lang.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/** <br>
 * 标题:线索推送相关的服务类 <br>
 * 描述: <br>
 * 公司: www.iflytek.com<br>
 * 
 * @autho dgyu
 * @time 2022年10月25日 上午11:17:15 */
@Service
public class CluePushServiceImpl extends ServiceImpl<CluePushMapper, CluePush> implements ICluePushService {

	private static final Logger	   logger = LoggerFactory.getLogger(CluePushServiceImpl.class);
	@Autowired
	private CluePushMapper		   cluePushMapper;
	@Autowired
	private CluePushDetailMapper   cluePushDetailMapper;
	@Autowired
	private TaskDetailMapper	   taskDetailMapper;
	@Autowired
	private ClueMapper			   clueMapper;
	@Autowired
	private TaskMapper			   taskMapper;
	@Autowired
	private ClueCollectionMapper   clueCollectionMapper;
	@Autowired
	private IClueCollectionService iClueCollectionService;
	@Autowired
	private ICluePushService    iCluePushService;

	@Override
	public int cluePush(PushClueDTO pushClueDTO) {
		List<ClueReceiver> receiverList = pushClueDTO.getReceiverList();
		if (CollectionUtils.isEmpty(receiverList)) {
			logger.error("未选择推送人");
			return -1;
		}
		String pusherLoginId = pushClueDTO.getPusherLoginId();
		String pusherLoginName = pushClueDTO.getPusherLoginName();
		Date createTime = new Date();
		List<CluePushDetail> detailList = new ArrayList<>();
		Integer clueId = pushClueDTO.getClueId();
		Integer collectionId = pushClueDTO.getCollectionId();
		Integer detailId = pushClueDTO.getDetailId();
		// 线索推送
		this.dealCluePush(clueId, receiverList, createTime, pusherLoginId, pusherLoginName, detailList);
		// 线索集推送
		this.dealCollectionPush(collectionId, receiverList, createTime, pusherLoginId, pusherLoginName, detailList);
		// 线索集总览推送
		this.dealClueAllPush(detailId, receiverList, createTime, pusherLoginId, pusherLoginName, detailList);
		if (CollectionUtils.isNotEmpty(detailList)) {
			int cnt = cluePushDetailMapper.insertOrupdateCluePushDetail(detailList);
			return cnt;
		}
		return -2;
	}

	private void dealCluePush(Integer clueId, List<ClueReceiver> receiverList, Date createTime, String pusherLoginId, String pusherLoginName, List<CluePushDetail> detailList) {
		if (clueId == null || clueId <= 0) {
			return;
		}
		Clue clue = clueMapper.selectById(clueId);
		if (null == clue) {
			logger.error("被推送的线索id不存在 clueId：{}", clueId);
			return;
		}
		Integer taskId = clue.getTaskId();
		String clueName=clue.getClueName();
		Task task = taskMapper.selectById(taskId);

		LambdaQueryWrapper<TaskDetail> wrapper = new LambdaQueryWrapper<>();
		wrapper.select(TaskDetail::getId,TaskDetail::getWeight);
		wrapper.eq(TaskDetail::getIsDelete, 0);
		wrapper.eq(TaskDetail::getClueId, clueId);
		wrapper.orderByDesc(TaskDetail::getSupervisionObject);
		List<TaskDetail> detais = taskDetailMapper.selectList(wrapper);
		if (CollectionUtils.isEmpty(detais)) {
			return;
		}
		if (CollectionUtils.isNotEmpty(detais)) {
			receiverList.forEach(v -> {
				Integer pushId = 0;
				CluePush cluePush = new CluePush();
				cluePush.setRybm(v.getRybm());
				cluePush.setMc(v.getMc());
				cluePush.setClueOrCollectionId(clueId);
				cluePush.setType(PushEnum.ClUE_ID.getCode());
				cluePush.setPusherLoginId(pusherLoginId);
				cluePush.setPusherLoginName(pusherLoginName);
				cluePush.setDlbm(v.getDlbm());
				cluePush.setDwbm(v.getDwbm());
				cluePush.setDwmc(v.getDwmc());
				cluePush.setName(clueName+"-全量线索");
				cluePush.setModelId(task.getModelId());
				cluePush.setModelName(task.getTaskName());
				cluePush.setDatasetId(task.getDatasetId());
				cluePush.setDatasetName(task.getDatasetName());
				cluePush.setClueType(ClueTypeEnum.TUISONG.getCode());
				cluePush.setCreateTime(createTime);
				this.cluePushMapper.insertOrupdateCluePush(cluePush);
				pushId = cluePush.getId();
				Integer newPushNum=0;
				{
					LambdaQueryWrapper<CluePush> query=new LambdaQueryWrapper<>();
					query.eq(CluePush::getClueOrCollectionId,clueId).eq(CluePush::getRybm,v.getRybm()).eq(CluePush::getType,PushEnum.ClUE_ID.getCode());
					CluePush cluePushed=this.baseMapper.selectOne(query);
					pushId=cluePushed.getId();
					newPushNum=cluePushed.getNewPushNum() == null ?0:cluePushed.getNewPushNum();
				}
				// 更新新推送线索数
				LambdaUpdateWrapper<CluePush> lambdaUpdateWrapper = new LambdaUpdateWrapper<CluePush>().set(CluePush::getNewPushNum, detais.size()+newPushNum).set(CluePush::getUpdateTime, createTime)
				        .eq(CluePush::getId, pushId);
				this.baseMapper.update(null, lambdaUpdateWrapper);
				final Integer finalPushId = pushId;
				detais.forEach(detail -> {
					CluePushDetail cluePushDetail = new CluePushDetail();
					cluePushDetail.setPushId(finalPushId);
					cluePushDetail.setDetailId(detail.getId());
					cluePushDetail.setRybm(v.getRybm());
					cluePushDetail.setEvaluationResult(EvaluationResultEnum.UNDONE.getCode());
					cluePushDetail.setCreateTime(createTime);
					cluePushDetail.setWeight(detail.getWeight());
					detailList.add(cluePushDetail);
				});
			});
		}
		// 更新线索已推送
		LambdaUpdateWrapper<Clue> lambdaUpdateWrapper = new LambdaUpdateWrapper<Clue>();
		lambdaUpdateWrapper.eq(Clue::getId, clueId).set(Clue::getCluePushStatus, CluePushStatusEnum.PUSHED.getCode()).set(Clue::getUpdateTime, createTime)
		.set(Clue::getCluePushPlatform, CluePushPlatformEnum.XIANSUOGUANLIPINGTAI.getCode());
		this.clueMapper.update(null, lambdaUpdateWrapper);
	}

	private void dealCollectionPush(Integer collectionId, List<ClueReceiver> receiverList, Date createTime, String pusherLoginId, String pusherLoginName, List<CluePushDetail> detailList) {
		if (collectionId == null || collectionId <= 0) {
			return;
		}
		ClueCollection clueCollection = clueCollectionMapper.selectById(collectionId);
		if (null == clueCollection) {
			logger.error("被推送的线索集id不存在 collectionId：{}", collectionId);
			return;
		}
		// 查询线索集所有线索 不分页查询所有
		QueryClueDeatilDTO clueDeatilDTO = new QueryClueDeatilDTO();
		clueDeatilDTO.setCollectionId(collectionId);
		clueDeatilDTO.setPageNo(1);
		clueDeatilDTO.setPageSize(Integer.MAX_VALUE);
		IPage<TaskDetail> iPage = iClueCollectionService.collectionDetail(clueDeatilDTO);
		List<TaskDetail> details = iPage.getRecords();
		if (CollectionUtils.isEmpty(details)) {
			return;
		}
		if (CollectionUtils.isNotEmpty(details)) {
			receiverList.forEach(v -> {
				Integer pushId = 0;
				Integer newPushNum=0;
				CluePush cluePush = new CluePush();
				cluePush.setRybm(v.getRybm());
				cluePush.setMc(v.getMc());
				cluePush.setClueOrCollectionId(collectionId);
				cluePush.setType(PushEnum.CLUE_COLLECTION.getCode());
				cluePush.setPusherLoginId(pusherLoginId);
				cluePush.setPusherLoginName(pusherLoginName);
				cluePush.setDlbm(v.getDlbm());
				cluePush.setDwbm(v.getDwbm());
				cluePush.setDwmc(v.getDwmc());
				cluePush.setName(clueCollection.getName());
				cluePush.setClueType(ClueTypeEnum.TUISONG.getCode());
				cluePush.setCreateTime(createTime);
				this.cluePushMapper.insertOrupdateCluePush(cluePush);
				pushId = cluePush.getId();
				{
					LambdaQueryWrapper<CluePush> query=new LambdaQueryWrapper<>();
					query.eq(CluePush::getClueOrCollectionId,collectionId).eq(CluePush::getRybm,v.getRybm()).eq(CluePush::getType,PushEnum.CLUE_COLLECTION.getCode());
					CluePush cluePushed=this.baseMapper.selectOne(query);
					pushId=cluePushed.getId();
					newPushNum=cluePushed.getNewPushNum() == null ?0:cluePushed.getNewPushNum();
				}
				// 更新新推送线索数
				LambdaUpdateWrapper<CluePush> wrapper = new LambdaUpdateWrapper<CluePush>().set(CluePush::getNewPushNum, details.size()+newPushNum).set(CluePush::getUpdateTime, createTime)
				        .eq(CluePush::getId, pushId);
				this.baseMapper.update(null, wrapper);
				final Integer finalPushId = pushId;
				details.forEach(detail -> {
					CluePushDetail cluePushDetail = new CluePushDetail();
					cluePushDetail.setPushId(finalPushId);
					cluePushDetail.setDetailId(detail.getId());
					cluePushDetail.setRybm(v.getRybm());
					cluePushDetail.setEvaluationResult(EvaluationResultEnum.UNDONE.getCode());
					cluePushDetail.setCreateTime(createTime);
					cluePushDetail.setWeight(detail.getWeight());
					detailList.add(cluePushDetail);
				});
			});
		}
	}

	private void dealClueAllPush(Integer detailId, List<ClueReceiver> receiverList, Date createTime, String pusherLoginId, String pusherLoginName, List<CluePushDetail> detailList) {
		if (detailId == null || detailId <= 0) {
			return;
		}
		TaskDetail  taskDetail=this.taskDetailMapper.selectById(detailId);
		receiverList.forEach(v -> {
			Integer pushId = 0;
			CluePush cluePush = new CluePush();
			cluePush.setRybm(v.getRybm());
			cluePush.setMc(v.getMc());
			cluePush.setClueOrCollectionId(PushEnum.CLUE_ALL.getValue());
			cluePush.setType(PushEnum.CLUE_ALL.getCode());
			cluePush.setPusherLoginId(pusherLoginId);
			cluePush.setPusherLoginName(pusherLoginName);
			cluePush.setDlbm(v.getDlbm());
			cluePush.setDwbm(v.getDwbm());
			cluePush.setDwmc(v.getDwmc());
			cluePush.setName(PushEnum.CLUE_ALL.getDesc());
			cluePush.setClueType(ClueTypeEnum.TUISONG.getCode());
			cluePush.setCreateTime(createTime);
			this.cluePushMapper.insertOrupdateCluePush(cluePush);

			pushId = cluePush.getId();
			Integer newPushNum=0;
			{
				LambdaQueryWrapper<CluePush> query=new LambdaQueryWrapper<>();
				query.eq(CluePush::getClueOrCollectionId,PushEnum.CLUE_ALL.getValue()).eq(CluePush::getRybm,v.getRybm()).eq(CluePush::getType,PushEnum.CLUE_ALL.getCode());
				CluePush cluePushed=this.baseMapper.selectOne(query);
				pushId=cluePushed.getId();
				newPushNum=cluePushed.getNewPushNum() == null ?0:cluePushed.getNewPushNum();
			}
			// 更新新推送线索数
			LambdaUpdateWrapper<CluePush> wrapper = new LambdaUpdateWrapper<CluePush>().set(CluePush::getNewPushNum, newPushNum+1).set(CluePush::getUpdateTime, createTime).eq(CluePush::getId, pushId);
			this.baseMapper.update(null, wrapper);
			CluePushDetail cluePushDetail = new CluePushDetail();
			cluePushDetail.setPushId(pushId);
			cluePushDetail.setDetailId(detailId);
			cluePushDetail.setRybm(v.getRybm());
			cluePushDetail.setEvaluationResult(EvaluationResultEnum.UNDONE.getCode());
			cluePushDetail.setCreateTime(createTime);
			cluePushDetail.setWeight(Optional.ofNullable(taskDetail).map(TaskDetail::getWeight).orElse(0));
			detailList.add(cluePushDetail);
		});
	}

	@Override
	public IPage<CluePush> listInquisitor(QueryClueDTO queryClueDTO) {
		Page<CluePush> page = new Page<>(queryClueDTO.getPageNo(), queryClueDTO.getPageSize());
		LambdaQueryWrapper<CluePush> wrapper = new LambdaQueryWrapper<CluePush>();
		if (StringUtils.isNotEmpty(queryClueDTO.getRybm())) {
			wrapper.eq(CluePush::getRybm, queryClueDTO.getRybm());
		}
		if (queryClueDTO.getEvaluationResult() != null && queryClueDTO.getEvaluationResult() > 0) {
			wrapper.eq(CluePush::getEvaluationResult, queryClueDTO.getEvaluationResult());
		}
		if (queryClueDTO.getClueType() != null && queryClueDTO.getClueType() > 0) {
			wrapper.eq(CluePush::getClueType, queryClueDTO.getClueType());
		}
		if (queryClueDTO.getPushStartTime() != null) {
			wrapper.ge(CluePush::getUpdateTime, queryClueDTO.getPushStartTime());
		}
		if (queryClueDTO.getPushEndTime() != null) {
			wrapper.le(CluePush::getUpdateTime, queryClueDTO.getPushEndTime());
		}
		/*wrapper.orderByAsc(CluePush::getType);
		wrapper.orderByDesc(CluePush::getUpdateTime);*/
		wrapper.last("ORDER BY CASE WHEN TYPE IN(1) THEN 0 ELSE 1 END,update_time DESC");
		IPage<CluePush> pageCluePush = this.baseMapper.selectPage(page, wrapper);
		List<CluePush> records = pageCluePush.getRecords();
		if (CollectionUtils.isNotEmpty(records)) {
			List<Integer> pushIdList = records.stream().map(CluePush::getId).collect(Collectors.toList());
			LambdaQueryWrapper<CluePushDetail> lambdaQueryWrapper = new LambdaQueryWrapper<CluePushDetail>();
			lambdaQueryWrapper.in(CluePushDetail::getPushId, pushIdList);
			List<CluePushDetail> details = this.cluePushDetailMapper.selectList(lambdaQueryWrapper);
			Map<Integer, List<CluePushDetail>> map = details.stream().collect(Collectors.groupingBy(CluePushDetail::getPushId));
			records.forEach(record -> {
				Integer pushId = record.getId();
				List<CluePushDetail> mapDetails = map.get(pushId);
				if (CollectionUtils.isEmpty(mapDetails)) {
					record.setTotalClueNum(0);
				}
				else {
					record.setTotalClueNum(CollectionUtils.size(mapDetails));
				}
			});
		}
		return pageCluePush;
	}

	@Override
	public int listInquisitorFeedback(JSONObject jSONObject) {
		Integer id = jSONObject.getInteger("id");
		Integer evaluationResult = jSONObject.getInteger("evaluationResult");
		String bmsah = jSONObject.getString("bmsah");
		String ajmc = jSONObject.getString("ajmc");
		String info = jSONObject.getString("info");
		LambdaUpdateWrapper<CluePush> wrapper = new LambdaUpdateWrapper<>();
		if (evaluationResult != null && evaluationResult >= 0) {
			wrapper.set(CluePush::getEvaluationResult, evaluationResult);
		}
		if (StringUtils.isNotEmpty(bmsah)) {
			wrapper.set(CluePush::getBmsah, bmsah);
		}
		if (StringUtils.isNotEmpty(ajmc)) {
			wrapper.set(CluePush::getAjmc, ajmc);
		}
		if (StringUtils.isNotEmpty(info)) {
			wrapper.set(CluePush::getInfo, info);
		}
		wrapper.set(CluePush::getUpdateTime, new Date());
		wrapper.eq(CluePush::getId, id);
		int rows = this.cluePushMapper.update(null, wrapper);
		return rows;
	}

	@Override
	public IPage<ManageTaskDetailDTO> listInquisitorManage(ManageDTO manageDTO, Boolean isManage) {
		Integer pushId = manageDTO.getPushId();
		IPage<ManageDTO> page = new Page<>(manageDTO.getPageNo(), manageDTO.getPageSize());
		IPage<ManageTaskDetailDTO> data = this.taskDetailMapper.queryManageDetailPage(page, pushId, manageDTO.getKeyword(),manageDTO.getPointId());
		// 点击管理后 需要把新推送线索数更新成0
		if (isManage) {
			LambdaUpdateWrapper<CluePush> lambdaUpdateWrapper = new LambdaUpdateWrapper<>();
			lambdaUpdateWrapper.eq(CluePush::getId, pushId);
			lambdaUpdateWrapper.set(CluePush::getNewPushNum, 0);
			//lambdaUpdateWrapper.set(CluePush::getUpdateTime, new Date());
			this.cluePushMapper.update(null, lambdaUpdateWrapper);
		}
		return data;
	}

	@Override
	public List<ClueCollectionDTO> queryInquisitorCollection(String rybm) {
		List<ClueCollectionDTO> resut = new ArrayList<>();
		LambdaQueryWrapper<CluePush> lambdaQueryWrapper = new LambdaQueryWrapper<CluePush>();
		lambdaQueryWrapper.select(CluePush::getId, CluePush::getName);
		lambdaQueryWrapper.eq(CluePush::getRybm, rybm);
		lambdaQueryWrapper.eq(CluePush::getType, PushEnum.CLUE_COLLECTION.getCode());
		// lambdaQueryWrapper.eq(CluePush::getClueType,ClueTypeEnum.ZIJIAN.getCode());
		lambdaQueryWrapper.orderByDesc(CluePush::getCreateTime);
		List<CluePush> puehes = this.cluePushMapper.selectList(lambdaQueryWrapper);
		puehes.forEach(push -> {
			ClueCollectionDTO clueCollectionDTO = new ClueCollectionDTO();
			clueCollectionDTO.setId(push.getId());
			clueCollectionDTO.setName(push.getName());
			resut.add(clueCollectionDTO);
		});
		return resut;
	}

	@Override
	public CommonResponse addInquisitorCollection(JSONObject jsonObject) {
		String name = jsonObject.getString("name");
		String rybm = jsonObject.getString("rybm");
		String mc = jsonObject.getString("mc");
		String dlbm = jsonObject.getString("dlbm");
		String dwbm = jsonObject.getString("dwbm");
		String dwmc = jsonObject.getString("dwmc");
		if (StringUtils.isEmpty(rybm) || StringUtils.isEmpty(mc) || StringUtils.isEmpty(dlbm) || StringUtils.isEmpty(dwbm) || StringUtils.isEmpty(dwmc) || StringUtils.isEmpty(name)) {
			return CommonResponse.failed("线索名称、人员编码、名称、登录编码、单位编码、单位名称都不能为空");
		}
		if (StringUtils.isEmpty(rybm)) {
			return CommonResponse.failed(ResultEnum.CLUE_RYBM_IS_NULL);
		}
		if (StringUtils.isEmpty(name)) {
			return CommonResponse.failed(ResultEnum.CLUE_NAME_IS_NULL);
		}
		LambdaQueryWrapper<CluePush> lambdaQueryWrapper = new LambdaQueryWrapper<>();
		lambdaQueryWrapper.eq(CluePush::getName, name);
		lambdaQueryWrapper.eq(CluePush::getRybm, rybm);
		Long rows = this.baseMapper.selectCount(lambdaQueryWrapper);
		if (rows > 0L) {
			return CommonResponse.failed(ResultEnum.CLUE_COLLECTION_NAME_IS_EXIST);
		}
		CluePush cluePush = new CluePush();
		cluePush.setRybm(rybm);
		cluePush.setMc(mc);
		cluePush.setClueOrCollectionId(null);
		cluePush.setType(PushEnum.CLUE_COLLECTION.getCode());
		cluePush.setPusherLoginId(rybm);
		cluePush.setPusherLoginName(mc);
		cluePush.setDlbm(dlbm);
		cluePush.setDwbm(dwbm);
		cluePush.setDwmc(dwmc);
		cluePush.setName(name);
		cluePush.setNewPushNum(0);
		// 自建线索集
		cluePush.setClueType(ClueTypeEnum.ZIJIAN.getCode());
		cluePush.setCreateTime(new Date());
		this.baseMapper.insert(cluePush);
		return CommonResponse.success(cluePush.getId());
	}

	@Override
	public CommonResponse addMap(InquisitorAddMapDTO inquisitorAddMapDTO) {
		Integer taskDetailId = inquisitorAddMapDTO.getId();
		String rybm = inquisitorAddMapDTO.getRybm();
		Set<Integer> collectionIds = inquisitorAddMapDTO.getCollectionIds();
		if (StringUtils.isEmpty(rybm)) {
			return CommonResponse.failed(ResultEnum.RYBM_IS_NULL.getDesc());
		}
		if (CollectionUtils.isEmpty(collectionIds)) {
			return CommonResponse.failed(ResultEnum.CLUE_COLLECTION_UNSELECTED_ERROR.getDesc());
		}
		// 此线索已经加入过的线索集
		LambdaQueryWrapper<CluePushDetail> cluePushDetaillambdaQueryWrapper = new LambdaQueryWrapper<CluePushDetail>();
		cluePushDetaillambdaQueryWrapper.eq(CluePushDetail::getRybm, rybm);
		cluePushDetaillambdaQueryWrapper.eq(CluePushDetail::getDetailId, taskDetailId);
		List<CluePushDetail> details = this.cluePushDetailMapper.selectList(cluePushDetaillambdaQueryWrapper);
		// 已加入过的线索集
		Set<Integer> joinedset = details.stream().map(CluePushDetail::getPushId).collect(Collectors.toSet());
		// 过滤出未加入过的线索集
		Set<Integer> unjoinedSet = collectionIds.stream().filter(v -> !joinedset.contains(v)).collect(Collectors.toSet());
		if (CollectionUtils.isNotEmpty(unjoinedSet)) {
			Date d = new Date();
			List<CluePushDetail> datas = new ArrayList<>();
			unjoinedSet.forEach(pushId -> {
				CluePushDetail cluePushDetail = new CluePushDetail();
				cluePushDetail.setDetailId(taskDetailId);
				cluePushDetail.setPushId(pushId);
				cluePushDetail.setCreateTime(d);
				cluePushDetail.setRybm(rybm);
				datas.add(cluePushDetail);
			});
			this.cluePushDetailMapper.insertOrupdateCluePushDetail(datas);
		}
		//线索集 更新时间
		List<CluePush> list=new ArrayList<>();
		collectionIds.forEach(pushId->{
			CluePush cluePush=new CluePush();
			cluePush.setId(pushId);
			cluePush.setUpdateTime(new Date());
			list.add(cluePush);
		});
		this.iCluePushService.updateBatchById(list);
		return CommonResponse.success();
	}

	@Override
	public Integer setInquisitorWeight(Integer pushDetailId, Integer weight) {
		LambdaUpdateWrapper<CluePushDetail> wrapper = new LambdaUpdateWrapper<CluePushDetail>().set(CluePushDetail::getWeight, weight).set(CluePushDetail::getUpdateTime, new Date())
		        .eq(CluePushDetail::getId, pushDetailId);

		int rows = this.cluePushDetailMapper.update(null, wrapper);
		return rows;
	}
}
